package middleware

import (
	"net/http"
)

type UserAgentMiddleware struct {
}

func NewUserAgentMiddleware() *UserAgentMiddleware {
	return &UserAgentMiddleware{}
}

func (m *UserAgentMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		// TODO generate middleware implement function, delete after code implementation

		//get := r.Header.Get("token")
		//if get == ""  {
		//	resp := &types.Response{
		//		Code:    0,
		//		Message: "token未登录",
		//		Data:    nil,
		//	}
		//	httpx.OkJsonCtx(r.Context(), w, resp)
		//	return
		//}
		//token, s := pkg.Token(token)
		//if s != "" {
		//	resp := &types.Response{
		//		Code:    0,
		//		Message: s,
		//		Data:    token,
		//	}
		//	httpx.OkJsonCtx(r.Context(), w, resp)
		//	return

		// Passthrough to next handler if need

	}
	//id := token["userid"]
	//r.ParseForm()
	//r.Form.Set("userid",id.(string))
	//	next(w, r)

}
